package com.example.mqtt.paho.mqtt.producer;

import org.springframework.integration.annotation.MessagingGateway;
import org.springframework.integration.mqtt.support.MqttHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

/**
 * @author long
 */
//指定生产者的通道名称
@MessagingGateway(defaultRequestChannel = "mqttOutputChannel")
@Component
public interface MqttProducer {

    /**
     * 发送消息
     *
     * @param topic   消息主题
     * @param qos     消息质量
     * @param payload 实际消息内容
     */
    void sendData(@Header(MqttHeaders.TOPIC) String topic, @Header(MqttHeaders.QOS) int qos, byte[] payload);

}
